// ignore_for_file: must_be_immutable, prefer_typing_uninitialized_variables

import 'package:aitao_flutter/res/r.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../style/box_style.dart';
import '../style/color_style.dart';
import '../style/edgeInsets_style.dart';

class ShowShareSheet extends StatefulWidget {
  ShowShareSheet({Key? key, required this.itemCallBack}) : super(key: key);
  var itemCallBack;
  @override
  State<ShowShareSheet> createState() => _ShowShareSheetState();
}

class _ShowShareSheetState extends State<ShowShareSheet> {
  List<Map> shareList = [
    {'img': ImagePath.assetsShareWechat, 'title': '微信好友'},
    {'img': ImagePath.assetsShareFriend, 'title': '朋友圈'},
    // {'img': ImagePath.assetsShareQQ, 'title': 'QQ'},
    // {'img': ImagePath.assetsShareZone, 'title': 'QQ空间'},
    {'img': ImagePath.assetsShareDownload, 'title': '保存海报'},
    {'img': ImagePath.assetsShareLink, 'title': '复制链接'},
  ];

  @override
  Widget build(BuildContext context) {
    return Material(
        child: Container(
      height: 135.w,
      color: ColorStyle.borderColor,
      padding: EdgeInsetsStyle.edgeInsets(22, 16),
      child: GridView.builder(
        padding: EdgeInsets.zero,
        gridDelegate:
            const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4),
        itemBuilder: ((context, index) {
          return GestureDetector(
            child: Container(
                color: ColorStyle.borderColor,
                child: Column(
                  children: [
                    Image.asset(
                      shareList[index]['img'],
                      width: 50.w,
                      height: 50.w,
                    ),
                    Box.vBox5,
                    Text(
                      shareList[index]['title'],
                      style: const TextStyle(
                          fontSize: 11,
                          color: Color.fromRGBO(119, 119, 119, 1)),
                    ),
                  ],
                )),
            onTap: () {
              Navigator.pop(context);
              widget.itemCallBack(shareList[index]['title']);
            },
          );
        }),
        itemCount: shareList.length,
      ),
    ));
  }
}
